package com.olddriver.crm.domain;

import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class Role {
    private Long id;
    private String name;
    private String sn;
    private List<Permission> permissions;

    public String getPermissionNames() {
        if (permissions != null && permissions.size() > 0) {

            StringBuilder name = new StringBuilder();
            for (Permission permission : permissions) {
                name.append(permission.getName() + ",");
            }
            name.deleteCharAt(name.lastIndexOf(","));
            return name.toString();
        }
        return "";
    }
}
